
CC = g++
# CFLAGS = -std=c++14 -I.. -Wall -Wextra -lpthread 
CPPFLAGS = -std=c++14 -I.. -Wall -Wextra -lpthread 
#OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto
# OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/include/openssl -L/usr/lib/openssh/ -lssl -lcrypto
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz

output := ./build
$(shell if [ ! -e $(output) ];then mkdir -p $(output); fi)

# all: server client hello simplesvr benchmark

server : server.cc ../httplib.h
	$(CC) server.cc -o $(output)/server $(CPPFLAGS) $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT)

# client : client.cc ../httplib.h
# 	$(CC) client.cc -o $(output)/client $(CPPFLAGS)$(OPENSSL_SUPPORT) $(ZLIB_SUPPORT)

# hello : hello.cc ../httplib.h
# 	$(CC) hello.cc -o $(output)/hello $(CPPFLAGS)  $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT)

# simplesvr : simplesvr.cc ../httplib.h 
# 	$(CC) simplesvr.cc -o $(output)/simplesvr $(CPPFLAGS)  $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT)

# benchmark : benchmark.cc ../httplib.h 
# 	$(CC) benchmark.cc -o $(output)/benchmark $(CPPFLAGS) $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT)

# pem:
# 	openssl genrsa 2048 > $(output)/key.pem
# 	openssl req -new -key $(output)key.pem | openssl x509 -days 3650 -req -signkey $(output)key.pem > $(output)cert.pem

clean:
	rm -f  $(output)/server $(output)/client $(output)/hello $(output)/simplesvr $(output)/*.pem
